import pygame

images_path = "./images/"
explode_0 = images_path + "0.gif"
explode_1 = images_path + "1.gif"
explode_2 = images_path + "2.gif"
explode_3 = images_path + "3.gif"
explode_4 = images_path + "4.gif"
explode_5 = images_path + "5.gif"
explode_6 = images_path + "6.gif"
explode_7 = images_path + "7.gif"


class Explode:
    def __init__(self, tank):
        self.step = 0
        self.images = [
            pygame.image.load(explode_0),
            pygame.image.load(explode_1),
            pygame.image.load(explode_2),
            pygame.image.load(explode_3),
            pygame.image.load(explode_4),
            pygame.image.load(explode_5),
            pygame.image.load(explode_6),
            pygame.image.load(explode_7),
        ]
        self.image = self.images[self.step]
        self.rect = tank.rect
        self.live = True
        pass

    def display(self, window):
        if self.step < len(self.images):
            window.blit(self.image, self.rect)
            self.image = self.images[self.step]
            self.step += 1
        else:
            self.live = False
        pass
